/*
 * @Author: 肖芬芳 1911683843@qq.com
 * @Date: 2022-12-08 09:49:26
 * @LastEditors: 肖芬芳 1911683843@qq.com
 * @LastEditTime: 2022-12-09 16:23:08
 * @FilePath: \blog\src\views\admin\goods\classify\api\classifyServiceApi.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { ServerResponse } from '@/util/base/ServerResponse'
import { Request } from '@/util/http/axios'
import { SearchList, AddParams, StatusParams, ModifyParams } from "../params/secondClassParams"
import { ClassListVo } from "../Vo/classifyVo"

export default class SecondClassServiceApi {
    async getSecondClassList(searchList: SearchList): Promise<ServerResponse<ClassListVo>> {
        const res = await Request.post<ServerResponse<ClassListVo>, SearchList>(
            '/class/secondList',
            searchList)
        return res.data
    }

    async addSecondClass(addParams: AddParams): Promise<ServerResponse<any>> {
        const res = await Request.post<ServerResponse<any>, AddParams>(
            '/class/addSecondClass',
            addParams)
        return res.data
    }

    async changeSecondStatus(statusParams: StatusParams): Promise<ServerResponse<any>> {
        const res = await Request.post<ServerResponse<any>, StatusParams>(
            '/class/changeSecondStatus',
            statusParams)
        return res.data
    }

    // 获取详情
    async detail(id: string): Promise<ServerResponse<ClassListVo>> {
        const res = await Request.get<ServerResponse<ClassListVo>, string>(
            '/class/secondDetail/' + id + '')
        return res.data
    }

    // 编辑
    async modifySecondClass(modifyParams: ModifyParams): Promise<ServerResponse<ModifyParams>> {
        const res = await Request.post<ServerResponse<ModifyParams>, ModifyParams>(
            '/class/modifySecondClass',
            modifyParams)
        return res.data
    }
}